Basic of 2D Hologram Implementation

Basic of 2D Hologram Implementation

Clock Icon2023.05.30

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Basic Simulation of 2D Hologram (Encoding and Reconstruction) by using matplotlib Library.

The process involves representing an image as a tensor field, encoding it into a hologram, and then reconstructing the tensor field from the hologram.

Workflow procedure:

  • The image is loaded and converted to grayscale using the PIL library. Grayscale is commonly used for hologram encoding, but colour images can also be used.
    • PIL is Python Imaging Library helps to perform various operations on images. You can use it to open an image file, read its contents, and convert it to different formats. PIL provides functions to modify images by adjusting their size, cropping specific regions, rotating them, or applying filters and effects. You can also access and manipulate individual pixels in an image, for the best image editing.
  • The grayscale image is converted to a numpy array to facilitate further processing. The array represents the tensor field, where each pixel value corresponds to the intensity or amplitude of the field.
    • NumPy array is like a grid of values, where each value is of the same data type. The array can have one or more dimensions, representing rows and columns (for 2D arrays) or additional axes (for higher-dimensional arrays).
  • To encode the tensor field into a hologram, a 2D Fast Fourier Transform (FFT) is applied to the array
  • The FFT transforms the tensor field from the spatial domain to the frequency domain, revealing the frequency components present in the image.
    • spatial domain to the frequency domain.
    • Spatial domain refers to the "normal" representation of an image or signal as we see it visually. The domain where we can directly observe the variations in intensity or Colour of the image.
    • Frequency domain refers to a representation of the image in terms of the frequency components present within it. Instead of representing the image in terms of individual pixel values, the frequency domain analyzes the image in terms of different frequencies and their respective magnitudes.
  • The resulting FFT array represents the hologram. It contains information about the amplitude and phase of the frequency components in the original tensor field.
    • For reconstruction, the hologram is subjected to an inverse FFT (IFFT) to transform it from the frequency domain back to the spatial domain. This process recovers the original tensor field, representing the reconstructed image.
    • fft.fft2 is a function that calculates the 2-dimensional Fast Fourier Transform of an input array, allowing us to analyze the frequency components present in the image and obtain a representation of the image in the frequency domain.
    • fft.fftshift is a function that rearranges the Fourier coefficients obtained from a Fourier transform, placing the zero-frequency component at the centre of the array for better visualisation and analysis of the frequency content.
  • Let's display the Encoded Hologram

  • Let's display the Reconstructed Hologram

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.